package Dialog;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.example.zelonghu.testgps.R;

/**
 * @author zelonghu QQ:1032006226
 * @name testGPS2
 * @class name：Dialog
 * @class describe
 * @time 2019/7/2 7:51 PM
 * @change
 * @chang time
 * @class juan
 */
public class Library_Detial_Dialog extends Dialog {
    public Library_Detial_Dialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    public static class Builder{
        TextView lname_tw;
        TextView lbooknumber_tw;
        TextView lphone_tw;
        TextView website_tw;
        TextView describe_tw;
        Library_Detial_Dialog mDialog;
        View mlayout;
        public Builder(Context context) {
            mDialog = new Library_Detial_Dialog(context, R.style.Theme_AppCompat_Dialog);
            LayoutInflater inflater =
                    (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            mlayout = inflater.inflate(R.layout.library_detial_dialog_layout, null, false);
            lname_tw = (TextView)mlayout.findViewById(R.id.library_name_tw);
            lbooknumber_tw = (TextView)mlayout.findViewById(R.id.library_bootcount_tw);
            lphone_tw = (TextView)mlayout.findViewById(R.id.library_phone_tw);
            website_tw = (TextView)mlayout.findViewById(R.id.library_website_tw);
            describe_tw = (TextView)mlayout.findViewById(R.id.library_describe_tw);

        }
        public Builder setlname(String name){
            lname_tw.setText(name);
            return this;
        };
        public Builder setlbookcount(String count){
            lbooknumber_tw.setText(count );
            return this;
        };
        public Builder setphone(String phone){
            lphone_tw.setText(phone);
            return this;
        };
        public Builder setwebsite(String web){
            website_tw.setText(web);
            return this;
        };
        public Builder setdescribe(String name){
            describe_tw.setText(name);
            return this;
        };
        public Library_Detial_Dialog create() {
            mDialog.setContentView(mlayout);
            mDialog.setCancelable(true);                //用户可以点击后退键关闭 Dialog
            mDialog.setCanceledOnTouchOutside(true);   //用户不可以点击外部来关闭 Dialog
            return mDialog;
        }
    }
}
